<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>明细查询</title>
		<link rel="stylesheet" href="__AGENT__/css/iconfont.css" />
		<link rel="stylesheet" href="__AGENT__/css/css.css" />
		<link rel="stylesheet" href="__PUBLIC__/static/layui/css/layui.css" media="all">
	</head>

	<body>
		{include file="public/header" /}
			<div class="index_conbox">
			<div class="index_content clearfix">
				{include file="public/lefter" /}
				<div class="right">
					<!--右侧内容-->
					<div class="rigtop">
						<span class="title">明细查询</span>
					</div>
					<div class="indrig_con">
						<div class="zizh_conbox" style="padding-top: 20px;">
							<!--选项卡内容开始-->
							<form id="my_form" action="{:url('count/detailed')}" method="post">
								<div class="zizh_con_1">
									<div class="shxx_row chax_row clearfix">
										<div class="left">交易时间：</div>
										<div class="right clearfix">
											<div class="layui-inline">
												<div class="layui-input-inline">
													<input type="text" class="layui-input" name="begin_time" id="begin_time" value="{$begin_time}" placeholder="yyyy年MM月dd日" size="15">
												</div>
											</div>
											<i class="chax_line"></i>
											<div class="layui-inline">
												<div class="layui-input-inline">
													<input type="text" class="layui-input" name="end_time" id="end_time" value="{$end_time}" placeholder="yyyy年MM月dd日" size="15">
												</div>
											</div>
										</div>
										<div class="left">订单号：</div>
										<div class="right clearfix">
											<input type="text" name="order_sn" id="order_sn" placeholder="订单号" class="chax_input" size="12"/>
										</div>
										<div class="left">收银员：</div>
										<div class="right clearfix">
											<div id="htselect">
												<select name="syylist" id='syylist'>
													<option value="">全部</option>
													{volist name="clerk_list" id="vo"}
													<option value="{$vo.id}">{$vo.name}</option>
													{/volist}
												</select>
											</div>
										</div>
									</div> 
									<div class="chax_rowbox clearfix">
										<div class="shxx_row clearfix">
											<div class="left">支付方式：</div>
											<div class="right clearfix">
												<div id="htselect">
													<select name="pay_type" id="pay_type">
														<option value="">全部</option>
														<option value="1">现金</option>
														<option value="2">微信</option>
														<option value="3">支付宝</option>
													</select>
												</div>
											</div>
										</div>
										<div class="shxx_row clearfix">
											<div class="left">订单类型：</div>
											<div class="right clearfix">
												<div id="htselect">
													<select name="order_type" id="order_type">
														<option value="">全部</option>
														<option value="2">扫码支付</option>
														<option value="6">线下收银</option>
														<option value="1">线上订单</option>
														<!--<option value="8">购买电子券</option>-->
													</select>
												</div>
											</div>
										</div>
										<div class="shxx_row clearfix">
											<div class="left">交易状态：</div>
											<div class="right clearfix">
												<div id="htselect">
													<select name="state" id="state">
														<option value="">全部</option>
														<option value="2">已付</option>
														<option value="1">未付</option>
													</select>
												</div>
											</div>
										</div> 
										<button type="submit" style="float: none;" onclick="return check_time()" class="htcxbtn">搜索</button>
									</div> 
							</form>
							<div class="chax_conbox">
								<div class="chax_jiegbt clearfix">
									<div class="chax_jieg">交易金额：
										<?php echo $xfprice ? $xfprice:0.00 ?>元 ,实际金额：
										<?php echo $sjprice ? $sjprice:0.00 ?>元 ； 赠送：
										<?php echo $zsscore ? $zsscore:0.00 ?>元,抵扣：
										<?php echo $dkscore ? $dkscore:0.00 ?>元,交易笔数 {$paylog->total()} </div>
									<div class="chax_xzbtnbox">
										<a href="#" onclick="check()"><i class="iconfont icon-daochu"></i>导出</a>
									</div>
								</div>
								<div class="chax_jiegnr">
									<table class="zizh_table1">
										<thead>
											<tr>
												<th style="width: 10%;">订单号</th>
												<th style="width: 8%;">订单类型</th>
												<th style="width: 8%;">会员编号</th>
												<th style="width: 8%;">支付方式</th>
												<th style="width: 8%;">交易金额</th>
												<th style="width: 8%;">实际金额</th>
												<th style="width: 6%;">收银员</th>
												<th style='width: 8%'>赠送</th>
												<th style='width: 8%'>抵扣</th>
												<th style="width: 10%;">日期</th>
											</tr>
										</thead>
										<tbody id="tbody">
											{volist name="paylog" id="vo" empty="$empty"}
											<tr>
												<td>{$vo.order_sn}</td>
												<td>{:log_type_msg($vo.order_type)}</td>
												<td>{$vo.uid}</td>
												<td>
													{switch name="$vo.pay_type"} {case value="1"}现金{/case} {case value="2"}微信{/case} {case value="3"}支付宝{/case} {case value="4"}银联{/case} {default /}银联 {/switch}
												</td>
												<td>{$vo['origin_price']}</td>
												<td>
													{if $vo['balance']==$vo['origin_price']} {$vo['balance']} {else/} {if $vo['member_score']>0}{$vo['balance']+$vo['np_price']}{else}{$vo['balance']}{/if} {/if}

												</td>
												<td>{$vo['sy_name']}</td>
												<!--<td>{$vo['member_score']}</td>
													<td>{$vo['member_score']}</td>-->
												<td>
													<?php echo $vo['payment_type']==1?$vo['member_score']:($vo['member_score']>0)?$vo['member_score']:'0.00' ?>
												</td>
												<td>
													<?php echo $vo['payment_type']==2?$vo['member_score']:($vo['member_score']<0)?$vo['member_score']:'0.00' ?>
												</td>
												<td>{$vo.add_time}</td>
											</tr>
											{/volist}
										</tbody>
									</table>

									<div class="fenye" style="display: block;">
										<ul class="pagination">
											{$paylog->render()}
										</ul>
									</div>
								</div>
							</div>
							</div>
						</div>

					</div>
				</div>
			</div>
		</div>
		{include file="public/footer" /}

	</body>

</html>
<script type="text/javascript">
	layui.use('laydate', function() {
		var laydate = layui.laydate;

		//日期控件
		laydate.render({
			elem: '#begin_time',
			type: 'datetime',
			format: 'yyyy-MM-dd HH:mm:ss'
		});

		laydate.render({
			elem: '#end_time',
			type: 'datetime',
			format: 'yyyy-MM-dd HH:mm:ss'
		});
	})

	function store_change(id) {
		$.ajax({
			type: "post",
			url: "{:url('count/syylist')}",
			data: {
				id: id
			},
			success: function(data) {
				var syylist = data.data;
				var select_htm = '';
				if(syylist && syylist.length < 1) {
					select_htm = "<option value=''>全部</option>";
				} else {
					for(var i = 0; i < syylist.length; i++) {
						select_htm = "<option value=''>全部</option>";
						select_htm += "<option value='" + syylist[i].id + "'>" + syylist[i].name + "</option>";
					}
				}
				$('#syylist').empty();
				$('#syylist').append(select_htm);

			},
			error: function(data) {
				var a = data;
			}
		});
	}

	function check() {
		var begin_time = $('#begin_time').val();
		var end_time = $('#end_time').val();
		var store_name = $('#store_name').val();
		var syylist = $('#syylist').val();
		var pay_type = $('#pay_type').val();
		var order_type = $('#order_type').val();
		var state = $('#state').val();
		var order_sn = $('#order_sn').text();
		window.location.href = "/agent/count/detail_dc.html?begin_time=" + begin_time + "&end_time=" + end_time + "&store_name=" + store_name +
			"&syylist=" + syylist + "&pay_type=" + pay_type + "&order_type=" + order_type + "&state=" + state + "&order_sn=" + order_sn;
	}
</script>